package scu.maqiang.heat;

import scu.maqiang.fes.FES2Q41;
import scu.maqiang.mesh.Mesh2Q4;
import scu.maqiang.mesh.ScalarFunc;
/*

Solve the Heat equation :

u_t -mu\Delta u = f(x,t)
uex(x,t) = sin(pi*x)*sin(pi*y)*exp(sin(t));
f(x,t) = sin(pi*x)*sin(pi*y)*exp(sin(t))*(cos(t)+2*pi^2*mu);
time scheme : theta - scheme
(u^(n+1)-u^n)/dt - mu\Delta ((1-theta)*u^n + theta*u^(n+1)) = theta*f(x,t+dt)+(1-theta)*f(x,t)
*/
public class ConvergenceRate {

	public static void main(String[] args) {
		double mu = 1.0;
		Mesh2Q4 mesh = new Mesh2Q4().square2D(10, 10);
		ScalarFunc uex = (xy, label, param) -> Math.sin(Math.PI * xy[0]) * Math.sin(Math.PI *xy[1]) * Math.exp(Math.sin(param[0]));
		ScalarFunc f = (xy, label, param) -> Math.sin(Math.PI * xy[0]) * Math.sin(Math.PI * xy[1]) * Math.exp(Math.sin(param[0])) * (Math.cos(param[0]) + 2 * Math.PI * Math.PI * mu);
		FES2Q41 fs = new FES2Q41(mesh);
		
	}

}
